import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;

public class Demo1 {


    public static void main(String[] args) {



        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();

        int count = 0;
        int max = 0;
        for(int i = 0; i < 32;i++) {
            if(((a >> i) & 1) == 1) {
                count++;
            }else{
                if(max  < count) {
                    max = count;
                }
                count = 0;
            }
        }

        System.out.println(max);
    }
}
